import steer
import vector
import seek
import assaultMarine
class Pathfollow (seek.Seek):
    
    def __init__(self):
        seek.Seek.__init__(self)
        self.currentWPT=0

    
    
    def setPath(self,spath):
        self.path=spath
        
    
    def calcPath(self, parent):
        parent.targetPos=self.path[self.currentWPT]
        toTarget= self.path[self.currentWPT].subtract(self.position)
        dist = toTarget.length()
        if dist<10.0:
            self.nextWPT()
        return self.calculate(self.path[self.currentWPT])
    def nextWPT(self):
        if self.currentWPT < len(self.path)-1:
            self.currentWPT+=1
            
        else:
            self.currentWPT=0